﻿#region Copyright and License
/*==============================================================================
 *  Copyright (c) www.51mvc.com Corporation.  All rights reserved.
 * ===============================================================================
 * This code and information is provided "as is" without warranty of any kind,
 * either expressed or implied, including but not limited to the implied warranties
 * of merchantability and fitness for a particular purpose.
 * ===============================================================================
 * Licensed under the GNU General Public License (GPL) v2
 * http://www.51mvc.com/
 * Create By 小鱼(Leven)  - http://leven.com.cn
 * ==============================================================================*/
#endregion
using System;

namespace JXT.PrimaryKey.Batman.Container
{
    /// <summary>
    /// 容器异常对象
    /// </summary>
    public class ContainerException : Exception {
        /// <summary>
        /// 容器类型
        /// </summary>
        public ContainerType ContainerType { get; private set; }

        /// <summary>
        /// 容器名称
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// 默认构造方法
        /// </summary>
        public ContainerException()
            : base("ContainerException") {
            ContainerType = ContainerType.Default;
            Name = "Not support.";
        }

        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="message">异常消息</param>
        public ContainerException(string message)
            : this(message, ContainerType.Default, "Not support.", null) {
        }

        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="type">容器类型</param>
        public ContainerException(ContainerType type)
            : this("ContainerException", type, "Not support.", null) {
        }

        /// <summary>
        ///构造方法
        /// </summary>
        /// <param name="message">异常信息</param>
        /// <param name="name">容器名称</param>
        public ContainerException(string message, string name)
            : this(message, ContainerType.Default, name, null) {
        }

        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="message">异常信息</param>
        /// <param name="type">容器类型</param>
        /// <param name="name">容器名称</param>
        /// <param name="innerException">包含的异常</param>
        public ContainerException(string message, ContainerType type, string name, Exception innerException)
            : base(message, innerException) {
            ContainerType = type;
            Name = name;
        }
    }
}
